/*
*/
#include "color.h"
#include <utility>

namespace rgbcolorutils
{
	//===============================================================================
    //                              COLOR FORMATS
    //===============================================================================
	const std::pair<e_COLOR_COMPONENTS,unsigned short> RGB888::COMPONENTS_LENGTH[RGB888::NB_COMPONENTS]= 
	{
		std::make_pair( e_CMP_RED,   8 ),
		std::make_pair( e_CMP_GREEN, 8 ),
        std::make_pair( e_CMP_BLUE,  8 ),
	};

    const std::pair<e_COLOR_COMPONENTS,unsigned short> XBGR8888::COMPONENTS_LENGTH[XBGR8888::NB_COMPONENTS]=
	{
		std::make_pair( e_CMP_UNUSED, 8 ),
		std::make_pair( e_CMP_BLUE,   8 ),
		std::make_pair( e_CMP_GREEN,  8 ),
		std::make_pair( e_CMP_RED,    8 )
	};

	const std::pair<e_COLOR_COMPONENTS,unsigned short> BGR555::COMPONENTS_LENGTH[BGR555::NB_COMPONENTS]= 
	{
		std::make_pair( e_CMP_UNUSED, 1 ),
		std::make_pair( e_CMP_BLUE,   5 ),
		std::make_pair( e_CMP_GREEN,  5 ),
		std::make_pair( e_CMP_RED,    5 )
	};


    unsigned int CreateABitMask( unsigned int length )
    {
        unsigned int mask = 1; 
        
        if( length > 0 )
            mask = (1 << length) | CreateABitMask( length - 1 );

        return mask;
    }

    unsigned int ShiftLeftABitMask( unsigned int shiftamount, unsigned int mask )
    {
        return mask << shiftamount;
    }
};